# Archlive <http://archlive-pkg.googlecode.com>

pkgname=screen-git
pkgver=20091012
pkgrel=1
pkgdesc="GNU Screen from GIT repository. Provides vertical splitting."
url="http://www.gnu.org/software/screen/"
arch=('i686' 'x86_64')
license=('GPL')
depends=('ncurses' 'shadow')
provides=('screen')
conflicts=('screen')
backup=('etc/screenrc' 'etc/pam.d/screen')
makedepends=('git' 'automake' 'autoconf')
install=('screen.install')
source=(screen.pam)
md5sums=(1059ce8a6c6763838f395c917afe54cf)

_gitroot="git://git.savannah.gnu.org/screen.git"
_gitname="screen"


build() {

  cd ${startdir}

  msg "Connecting to GIT server...."

  if [ -d $_gitname ] ; then
  	cd $_gitname && git pull origin
  	msg "The local files are updated."
  else
  	git clone $_gitroot
  fi

  [ -d $srcdir/$_gitname-build ] && rm -rf $srcdir/$_gitname-build
  git clone $startdir/$_gitname $srcdir/$_gitname-build

  msg "GIT checkout done or server timeout"
  msg "Starting make..."


  cd ${srcdir}/$_gitname-build/src/

  export MAKEFLAGS="-j1"
  ./autogen.sh
  ./configure --prefix=/usr --enable-pam \
        --with-sys-screenrc=/etc/screenrc --enable-colors256 \
       --enable-rxvt_osc --with-pty-group=$_ptygroup \
       --mandir=/usr/share/man
  make || return 1
  make DESTDIR=${startdir}/pkg install || return 1
  mkdir -p ${startdir}/pkg/etc/pam.d 
  install -m644 ${startdir}/screen.pam ${startdir}/pkg/etc/pam.d/screen

  cd etc/
  mkdir -p ${startdir}/pkg/usr/share/zsh/site-functions/
  install -m644 completer.zsh ${startdir}/pkg/usr/share/zsh/site-functions/screen
  mkdir -p ${startdir}/pkg/etc/skel/
  install -m644 etcscreenrc ${startdir}/pkg/etc/screenrc
  install -m644 screenrc ${startdir}/pkg/etc/skel/.screenrc

  rm -f ${pkgdir}/usr/share/info/dir
  rm -r ${srcdir}/$_gitname-build
}


